/*
 * Author :zhaoningbo
 * Date   :2011-8-25 16:07:58
 * Email  :zhaoningbo@hotmail.com
 * Blog   :http://zhaoningbo.iteye.com/
 */
package com.number.mt.await;

import java.io.Serializable;

public class MainDefault implements Serializable {

    private static final long serialVersionUID = -1368704967153347838L;

    public static void main(String[] args) {

        int _threadCount = 5;
        int _dataLeng = 2;

        CountDownLatchSignals cDLSignals = new CountDownLatchSignals(1,
                _threadCount);
        DataWagon dataWagon = new DataWagon(_threadCount, _dataLeng);

        for (int i = 0; i < _threadCount; i++) {
            new Thread(new FillDataThread(dataWagon, i, cDLSignals)).start();
        }

        System.out.println("READY TO WORK !");
        cDLSignals.getStartSignal().countDown();
        System.out.println("WORKING...");
        try {
            cDLSignals.getDoneSignal().await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("WORK COMPLETED !");
    }

}
